package com.forum.controller;

import com.forum.pojo.Tag;
import com.forum.result.Result;
import com.forum.service.TagService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/tag")
public class TagController {

    @Autowired
    TagService tagService;

    @ApiOperation(value = "按发帖数量显示话题")
    @GetMapping("/findAllTag")
    public Result<List<Tag>> findAll() {
        List<Tag> tags=tagService.findAll();
        if(tags!=null){
            return Result.ok(tags);
        }
        return null;
    }

}
